package com.jhd.fuzhou.util;

import android.content.Context;
import android.graphics.Typeface;
import android.text.Editable;
import android.text.TextWatcher;
import android.widget.EditText;
import android.widget.TextView;

import com.jhd.fuzhou.R;

/*将textView和editText字体背景修改*/
public class EditTextView {
    public static void showDialog(){

    }


    public static void editListener(EditText editText){
        if(!"".equals(editText.getText().toString().trim())){
            editText.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
        }
        editText.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {

            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
                if("".equals(s.toString())){
                    editText.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));
                }else{
                    editText.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
                }
            }

            @Override
            public void afterTextChanged(Editable s) {

            }
        });
    }
    public static void TextViewChange(TextView textView, Context context){
        if(textView.getText().toString().trim().equals("请选择")){
            //textView.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));
            textView.setTextColor(context.getResources().getColor(R.color.search));
        }else{
            //textView.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
            textView.setTextColor(context.getResources().getColor(R.color.black));
        }
    }
}
